package org.yourscrum.web;

privileged aspect CommentController_Roo_Controller {
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/comment", method = org.springframework.web.bind.annotation.RequestMethod.POST)    
    public java.lang.String CommentController.create(@org.springframework.web.bind.annotation.ModelAttribute("comment") org.yourscrum.domain.Comment comment, org.springframework.validation.BindingResult result) {    
        if (comment == null) throw new IllegalArgumentException("A comment is required");        
        for(javax.validation.ConstraintViolation<org.yourscrum.domain.Comment> constraint : javax.validation.Validation.buildDefaultValidatorFactory().getValidator().validate(comment)) {        
            result.rejectValue(constraint.getPropertyPath(), null, constraint.getMessage());            
        }        
        if (result.hasErrors()) {        
            return "comment/create";            
        }        
        comment.persist();        
        return "redirect:/comment/" + comment.getId();        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/comment/form", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String CommentController.createForm(org.springframework.ui.ModelMap modelMap) {    
        modelMap.addAttribute("comment", new org.yourscrum.domain.Comment());        
        return "comment/create";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/comment/{id}", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String CommentController.show(@org.springframework.web.bind.annotation.PathVariable("id") Long id, org.springframework.ui.ModelMap modelMap) {    
        if (id == null) throw new IllegalArgumentException("An Identifier is required");        
        modelMap.addAttribute("comment", org.yourscrum.domain.Comment.findComment(id));        
        return "comment/show";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/comment", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String CommentController.list(org.springframework.ui.ModelMap modelMap) {    
        modelMap.addAttribute("comments", org.yourscrum.domain.Comment.findAllComments());        
        return "comment/list";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(method = org.springframework.web.bind.annotation.RequestMethod.PUT)    
    public java.lang.String CommentController.update(@org.springframework.web.bind.annotation.ModelAttribute("comment") org.yourscrum.domain.Comment comment, org.springframework.validation.BindingResult result) {    
        if (comment == null) throw new IllegalArgumentException("A comment is required");        
        for(javax.validation.ConstraintViolation<org.yourscrum.domain.Comment> constraint : javax.validation.Validation.buildDefaultValidatorFactory().getValidator().validate(comment)) {        
            result.rejectValue(constraint.getPropertyPath(), null, constraint.getMessage());            
        }        
        if (result.hasErrors()) {        
            return "comment/update";            
        }        
        comment.merge();        
        return "redirect:/comment/" + comment.getId();        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/comment/{id}/form", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String CommentController.updateForm(@org.springframework.web.bind.annotation.PathVariable("id") java.lang.Long id, org.springframework.ui.ModelMap modelMap) {    
        if (id == null) throw new IllegalArgumentException("An Identifier is required");        
        modelMap.addAttribute("comment", org.yourscrum.domain.Comment.findComment(id));        
        return "comment/update";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/comment/{id}", method = org.springframework.web.bind.annotation.RequestMethod.DELETE)    
    public java.lang.String CommentController.delete(@org.springframework.web.bind.annotation.PathVariable("id") java.lang.Long id) {    
        if (id == null) throw new IllegalArgumentException("An Identifier is required");        
        org.yourscrum.domain.Comment.findComment(id).remove();        
        return "redirect:/comment";        
    }    
    
    @org.springframework.web.bind.annotation.InitBinder    
    public void CommentController.initBinder(org.springframework.web.bind.WebDataBinder binder) {    
        binder.registerCustomEditor(java.util.Date.class, new org.springframework.beans.propertyeditors.CustomDateEditor(new java.text.SimpleDateFormat("MM/dd/yyyy"), false));        
    }    
    
}
